package com.syx.migration.web;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.syx.migration.service.IJournalModuleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("migrate/journal")
public class JournalModuleController {

    private final IJournalModuleService journalModuleService;

    @DSTransactional
    @GetMapping("/all")
    public void all(){
        journalModuleService.migrateCatalogue();
        journalModuleService.migrateInfo();
        journalModuleService.migrateBorrow();
        journalModuleService.migrateReader();
    }

    /**
     * 期刊编目
     */
    @GetMapping("/catalogue")
    public void migrateCatalogue(){
        journalModuleService.migrateCatalogue();
    }


    /**
     * 期刊
     */
    @GetMapping("/info")
    public void migrateInfo(){
        journalModuleService.migrateInfo();
    }

    /**
     * 期刊借阅
     */
    @GetMapping("/borrow")
    public void migrateBorrow(){
        journalModuleService.migrateBorrow();
    }

    /**
     * 读者同步借阅数据
     */
    @GetMapping("/reader")
    public void migrateReader(){
        journalModuleService.migrateReader();
    }

    /**
     * 期刊编目复本数
     */
    @GetMapping("/catalogNum")
    public void migrateCatalogNum(){
        journalModuleService.migrateCatalogNum();
    }

    /**
     * 期刊借阅次数同步
     */
    @GetMapping("/borrowNum")
    public void migrateBorrowNum(){
        journalModuleService.migrateBorrowNum();
    }


    /**
     * 期刊入库记录同步
     */
    @GetMapping("/enter")
    public void migrateEnter(){
        journalModuleService.migrateEnter();
    }

    /**
     * 期刊流通记录同步
     */
    @GetMapping("/circulate")
    public void migrateCirculate(){
        journalModuleService.migrateCirculate();
    }


}
